package com.rz.htk.order.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rz.htk.order.entity.Order;
import com.rz.htk.order.entity.excel.CountOrder;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface OrderMapper extends BaseMapper<Order>{
    @Select("select * from order ")
    public List<Order> listOrder();

    @Select("select * from Order where code=#{code} and del_flag=0")
    public List<Order> listOrderByCode(String code);

    List<CountOrder> countOrder(@Param("adminIds") List<Integer> adminIds);

    List<Order> getWaitPushOrders();

    @Update("update ord_order set track_success = 1 where after_code = #{afterCode}")
    int updateTrackSuccess(@Param("afterCode") String afterCode);

    @Update("update ord_order set after_code = #{afterCode} where commodity_code = #{commodityCode}")
    int udapteOrderAfterCode(@Param("commodityCode") String commodityCode,@Param("afterCode") String afterCode);

    @Update("update ord_order set push_yousu_flag = 1 where after_code = #{afterCode}")
    int updatePushYousuSuccess(String afterCode);

    @Update("update ord_order set state = #{status} where after_code = #{afterCode}")
    int updateOrderStateByAfterCode(@Param("afterCode") String afterCode, @Param("status") Integer status);

    @Update("update ord_order set rmk_state = #{status} where after_code = #{afterCode}")
    int updateOrderRmkStateByAfterCode(@Param("afterCode") String afterCode, @Param("status") Integer status);
}
